import json

from typing import List


# from_row_numm 分页查询，从第几条开始
# ToRowNum 分页查询，第几条结束
def set_LoadBizObjects_params(schema_code: str, from_row_num: int, to_row_num: int = 500, matchers=[]):
    set_filter = {
        "FromRowNum": from_row_num,
        "RequireCount": False,
        "ReturnItems": [],
        "SortByCollection": [],
        "ToRowNum": to_row_num,  # 需要修改
        "Matcher": {
            "Type": "And",
            "Matchers": matchers
        }
    }
    params = {
        "ActionName": 'LoadBizObjects',
        "SchemaCode": schema_code,
        "Filter": json.dumps(set_filter, ensure_ascii=False).replace('"', '\"')
    }
    return params


def set_CreateBizObjects_params(schema_code: str, data):
    params = {
        "ActionName": "CreateBizObjects",
        "SchemaCode": schema_code,
        "BizObjectArray": data,
        "IsSubmit": "true"
    }
    return params
